import React, { Component } from 'react'
import { connect } from 'react-redux'
import action from './store/actionCreator/home'
class App extends Component {
  componentDidMount() {
    this.props.getProListData({limitNum: 2})
  }
  render() {
    const { proList } = this.props
    return (
      <div>
        {
          proList && proList.map((item, index) => {
            return (
              <p key = { index }> { item.proname } </p>
            )
          })
        }
      </div>
    )
  }
}

export default connect((state) => {
  return {
    proList: state.home.proList
  }
}, (dispatch) => {
  return {
    getProListData (params) {
      dispatch(action.getProListDataAction(params))
    }
  }
})(App)